# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=deepin-launcher
pkgver=5.6.1
_commit=d0109891448d863e19af7b11ced427a11411d28e
pkgrel=2
pkgdesc='Deepin desktop-environment - Launcher module'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/dde-launcher"
license=('GPL3')
depends=('gsettings-qt' 'qt5-svg' 'qt5-x11extras' 'startdde' 'deepin-qt5integration' 'deepin-menu'
         'deepin-daemon' 'deepin-qt-dbus-factory' 'xdg-user-dirs')
makedepends=('git' 'cmake' 'gmock' 'gtest' 'ninja' 'qt5-tools')
conflicts=('dde-launcher')
replaces=('dde-launcher')
groups=('deepin')
source=("git+https://github.com/linuxdeepin/dde-launcher.git#commit=$_commit")
sha512sums=('SKIP')

prepare() {
  cd dde-launcher

  # workaround slow window mode loading
  git cherry-pick -n 0612c1181f232eb1c7be05a40c9c951a51cd0f2a

  # fix namespace of dregionmonitor
  git cherry-pick -n 037fe068f42e379b0b7fd70bffdde040262ecd2d

  sed -i 's|/usr/share/backgrounds/default_background.jpg|/usr/share/backgrounds/deepin/desktop.jpg|' src/boxframe/*.cpp
}

build() {
  cd dde-launcher
  cmake . -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DWITHOUT_UNINSTALL_APP=
  ninja
}

check() {
  cd dde-launcher
  # ninja test
}

package() {
  cd dde-launcher
  DESTDIR="$pkgdir" ninja install
}
